package scau.jump.securitytrace.dataModel;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.swing.DefaultComboBoxModel;

import com.securitytrace.model.Address;

public class AddressComBoxModel extends DefaultComboBoxModel {

	private static final long serialVersionUID = -7508519407481849330L;
	private static Map<String,Long> addressMap = new HashMap<String, Long>();
	
	public void addItems(List<Address> addresses) {
		for(Address address : addresses) {
			if(addressMap.containsKey(address.getAddressName())) {
				addressMap.remove(address.getAddressName());
			}
			addressMap.put(address.getAddressName(), address.getId());
			super.addElement(address.getAddressName());
		}
	}
	/**以下为get/set方法*/
	public static Map<String, Long> getAddressMap() {
		return addressMap;
	}
}
